package com.example.oauth2.base.common.repository.impl;

import com.example.oauth2.base.common.repository.BaseJpaRepository;
import com.sun.jndi.toolkit.dir.SearchFilter;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.query.QueryUtils;
import org.springframework.data.jpa.repository.support.JpaEntityInformation;
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
import org.springframework.util.ObjectUtils;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
import java.io.Serializable;
import java.util.*;

public class BaseJpaRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRepository<T, ID> implements BaseJpaRepository<T, ID> {
    private static final Logger logger = LoggerFactory.getLogger(BaseJpaRepositoryImpl.class);

    @PersistenceContext(type = PersistenceContextType.EXTENDED)
    private EntityManager entityManager; // jpa 实体管理器

    public BaseJpaRepositoryImpl(JpaEntityInformation<T, ?> entityInformation, EntityManager entityManager) {
        super(entityInformation, entityManager);
        this.entityManager = entityManager;
    }

    public BaseJpaRepositoryImpl(Class<T> domainClass, EntityManager em) {
        super(domainClass, em);
        this.entityManager = em;
    }


    @Override
    public int deleteInBatch(T object) {
        return 0;
    }

    @Override
    public int deleteInBatch(List<T> objects) {
        return 0;
    }

    @Override
    public int deleteById(ID[] ids) {
        return 0;
    }

    @Override
    public List<T> find(List<SearchFilter> searchFilters) {
        return null;
    }

    @Override
    public Page<T> find(List<SearchFilter> searchFilters, Pageable page) {
        return null;
    }

    @Override
    public List<T> find(T entity) {
        return null;
    }

    @Override
    public Page<T> find(T entity, Pageable page) {
        return null;
    }

    @Override
    public T findOne(T entity) {
        return null;
    }

    @Override
    public T findOne(ID id) {
        return null;
    }

    @Override
    public <S extends T> T updateById(S param) {
        return null;
    }
}
